Ext.define('PJ.view.statisticalevaluationresults.List', {
    extend: 'AM.default.DefaultList',
    requires: ['AM.default.DefaultSearchForm',
               'AM.default.jsonp.DefaultLoadJsonp'//jsonp加载数据
               ],
    initComponent: function(){
        var me = this;
        me.columns = [{
            header: '培训班编号',
            dataIndex: 'r.thematicClassNumber',
            width: 110,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '培训班名称',
            dataIndex: 'r.thematicClassName',
            flex: 1,
            minWidth: 110,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '（班）开始时间',
            dataIndex: 'r.startingTime',
            width: 110,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '（班）结束时间',
            dataIndex: 'r.endTime',
            width: 110,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '委托部委',
            dataIndex: 'r.commissionedMinistries',
            width: 110,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '报名人数',
            dataIndex: 'r.enrollment',
            width: 90,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '已评价人数',
            dataIndex: 'r.ratedListings',
            width: 90,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '未评价人数',
            dataIndex: 'r.noRatings',
            width: 90,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '参评率（%）',
            dataIndex: 'r.PARTICIPATINGRate',
            width: 90,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '平均分',
            dataIndex: 'r.theAverageScore',
            width: 90,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '最高分',
            dataIndex: 'r.highestScore',
            width: 90,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '最低分',
            dataIndex: 'r.lowestScore',
            width: 90,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        }];
        me.store = Ext.create('PJ.' + prototype + '.statisticalevaluationresults.List', {
            isLoad: false
        });
        me.loadType = gj_onlineLearning_constant.loadType;
        me.callParent(arguments);
    },
  //导出
    onConfigureClick: function(exportUrl){
    	var me = this;
        var store = me.getStore();
        var params=store.proxy.extraParams;
        var href=exportUrl + "?";
        for(var param in params){
        	if(params[param] === undefined){
        		href+="&"+param+"=";
        	}else{
        		href+="&"+param+"="+params[param];
        	}
        }
        href = encodeURI(href);
        var atag = Ext.get("exportResume");
        atag.set({
            "href": href
        });
        atag.dom.click();
    },

    listeners: {
    	selectionchange: function(selModel, selected){
            this.down('#' + this.oldId + "Export").setDisabled(selected.length === 0);
        },
        viewready: function(){
        	var me = this;
        	//导出按钮集合
	    	var exportMenu = Ext.create('Ext.menu.Menu', {
	            items: [{
	                text: '培训班评估详情',
	        		iconCls: 'classDetailsIco',
	                listeners: {
	                	click: function(btn){
	                    	me.onConfigureClick(me.store.classDetailsUrl);
	                	}
	                }
	            }, {
	                text: '培训班评估分',
	        		iconCls: 'scoreIco',
	                listeners: {
	                	click: function(btn){
	                    	me.onConfigureClick(me.store.classScoreUrl);
	                	}
	                }
	            }, {
	                text: '主观题评估详情',
	        		iconCls: 'reportCardIco',
	                listeners: {
	                	click: function(btn){
	                    	me.onConfigureClick(me.store.subjectiveDetailsUrl);
	                	}
	                }
	            }]
	        });
            this.addDocked([{
                dock: 'top',
                xtype: "searchform",
                columnCount: 2,
                fieldDefaults: {
                    labelAlign: 'right',
                    labelWidth: 80,
                    maxLength: 100
                },
                items: [{
                    xtype: "textfield",
                    fieldLabel: '培训班编号',
                    name: "searchThematicClassNumber",
                    emptyText: "请输入培训班编号"
                },{
                    xtype: "textfield",
                    fieldLabel: '培训班名称',
                    name: "searchThematicClassName",
                    emptyText: "请输入培训班名称"
                }],
                grid: this
            },{
                xtype: 'toolbar',
                dock: 'top',
                displayInfo: true,
                items: [{
                    text: '导出',
                	xtype: 'button',
                    cls: 'floater',
                    textAlign: 'right',
                    arrowAlign: 'right',
                    itemId: this.oldId + 'Export',
                    enableToggle: true,
                    disabled: true,
                    iconAlign: 'left',
                    iconCls: 'deriveIco',
                    pressedCls: 'x-btn-focus',
                    menuActiveCls: 'x-btn-menu-active',
                    menu: exportMenu
                }, "->", "->", this.countSelectPanel]
            }]);
            // 触发权限过滤事件
            this.fireEvent("permission", this);
            var store = this.store;
            var params = store.proxy.extraParams;
            var newParams = {};
            Ext.apply(params, newParams);
            store.isLoad = true;
            store.load();
        },
        afterrender: function(){
            this.loadMask = new Ext.LoadMask(this, {
                msg: "正在加载中,请稍后...."
            });
        }
    }
});
